<?php

/**
 * This is the model class for table "tbl_member_profile_workers_school_timeline".
 *
 * The followings are the available columns in table 'tbl_member_profile_workers_school_timeline':
 * @property integer $member_profile_workers_id
 * @property integer $member_id
 * @property string $profile_type
 * @property string $company_or_school_name
 * @property integer $industry_or_course
 * @property string $title_or_speciality
 * @property string $company_or_school_department
 * @property integer $employees
 * @property string $status
 * @property string $realization
 * @property integer $start_year
 * @property integer $start_month
 * @property integer $end_year
 * @property integer $end_month
 * @property integer $is_actual
 *
 * The followings are the available model relations:
 * @property TblMember $member
 */
class TimelineWorks extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TimelineWorks the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_member_profile_workers_school_timeline';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('company_or_school_name', 'required'),
			array('member_id, industry_or_course, employees, start_year, start_month, end_year, end_month, is_actual', 'numerical', 'integerOnly'=>true),
			array('profile_type, company_or_school_name, title_or_speciality, company_or_school_department, status', 'length', 'max'=>50),
			array('realization', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('member_profile_workers_id, member_id, profile_type, company_or_school_name, industry_or_course, title_or_speciality, company_or_school_department, employees, status, realization, start_year, start_month, end_year, end_month, is_actual', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'member' => array(self::BELONGS_TO, 'TblMember', 'member_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'member_profile_workers_id' => 'Member Profile Workers',
			'member_id' => 'Member',
			'profile_type' => 'Profile Type',
			'company_or_school_name' => 'Company Or School Name',
			'industry_or_course' => 'Industry Or Course',
			'title_or_speciality' => 'Title Or Speciality',
			'company_or_school_department' => 'Company Or School Department',
			'employees' => 'Employees',
			'status' => 'Status',
			'realization' => 'Realization',
			'start_year' => 'Start Year',
			'start_month' => 'Start Month',
			'end_year' => 'End Year',
			'end_month' => 'End Month',
			'is_actual' => 'Is Actual',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('member_profile_workers_id',$this->member_profile_workers_id);
		$criteria->compare('member_id',$this->member_id);
		$criteria->compare('profile_type',$this->profile_type,true);
		$criteria->compare('company_or_school_name',$this->company_or_school_name,true);
		$criteria->compare('industry_or_course',$this->industry_or_course);
		$criteria->compare('title_or_speciality',$this->title_or_speciality,true);
		$criteria->compare('company_or_school_department',$this->company_or_school_department,true);
		$criteria->compare('employees',$this->employees);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('realization',$this->realization,true);
		$criteria->compare('start_year',$this->start_year);
		$criteria->compare('start_month',$this->start_month);
		$criteria->compare('end_year',$this->end_year);
		$criteria->compare('end_month',$this->end_month);
		$criteria->compare('is_actual',$this->is_actual);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}